package co.fitstart.signin.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;

import co.fitstart.entity.coach.PrincipalReportRelation;
import co.fitstart.entity.principal.Principal;

/**
 * 
 * @author dan
 *
 */
@Dao("hibernate")
public interface PrincipalDao {
    
    /**
     * 
     * @param name
     * @return
     */
    @Query("FROM Principal WHERE disabled = false AND name = :name")
    public Principal load(@Variable("name") String name);
    
    /**
     * 
     * @param principal
     * @return
     */
    @Query("FROM PrincipalReportRelation WHERE ( coach = :principal AND manager IS NULL ) OR ( manager = :principal AND coach IS NULL )")
    public PrincipalReportRelation getRelation(@Variable("principal") Principal principal);
    

}
